const http = require("http")
const sever = http.createServer((req,res)=>{
    console.log('method',http.request.method)
    console.log('url',request.url)
    const {pathname, searchParams} = new URL(request.url, 'http://localhost:8989')
    console.log('pathname', pathname)  // /login
  const username = searchParams.get('username')
  const pwd = searchParams.get('pwd')
  console.log('username pwd', username, pwd)
  request.on('data', (buffer) => {
    console.log('请求体数据', buffer.toString())
})
    response.statusCode = 201
    response.setHeader('Content-Type', 'text/html;charset=utf-8')
    response.end('<h1 style="color: red;">我是响应标题!</h1>')
})
server.listen(8080, () => {
    console.log('启动服务成功: http://localhost:8989')
  })
